<template>
	<view>
		<u-navbar :border-bottom="false" :background="{backgroundColor: '#F8F8F8'}" title="功能" title-color="#333333" :custom-back="goback" back-icon-color='#333333'></u-navbar>
		<view class="application-view">
			<application-cell title="资产盘点"></application-cell>
			<application-cell title="资产授权"></application-cell>
			<application-cell title="单据审批"></application-cell>
		</view>
		<u-tabbar v-model="current" :list="list" active-color="#0071C5" inactive-color="#D2D3D3" :before-switch="beforeSwitch"></u-tabbar>
	</view>
</template>

<script>
	import applicationCell from './application-cell.vue'
	export default {
		components: {
			applicationCell
		},
		data() {
			return {
				list: [{
						text: '首页',
						iconPath: "/static/img/property/home.png",
						selectedIconPath: "/static/img/property/select_home.png"
					},
					{
						text: '应用',
						iconPath: "/static/img/property/application.png",
						selectedIconPath: "/static/img/property/select_application.png"
					},
					{
						text: '我的',
						iconPath: "/static/img/property/mine.png",
						selectedIconPath: "/static/img/property/select_mine.png"
					}
				],
				current: 1
			}
		},
		methods: {
			goback() {
				uni.navigateBack({
					delta: 100,
					animationType: 'slide-out-right'
				})
			},
			beforeSwitch(index) {
				if (index == 0) {
					let pages = getCurrentPages()
					uni.navigateBack({
						delta: pages.length - 2
					})
					return false
				} else if (index == 1) {
					return false
				} else {
					let pages = getCurrentPages()
					if (pages.length == 3) {
						this.$u.route({
							url: 'pages/work/apply/property/mine/mine',
							animationType: 'fade-in'
						})
					} else {
						uni.navigateBack()
					}
					return false
				}
			}
		}
	}
</script>

<style>
	.application-view {
		display: flex;
		padding-top: 25rpx;
		padding-left: 25rpx;
		padding-right: 25rpx;
	}
</style>
